home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000824-20010305 / 000308_fdc@watsun.cc.columbia.edu_Mon Feb 19 09:41:23 EST 2001.msg < prev    next >
Text File  |  2020-01-01  |  4KB  |  81 lines

  1. Article: 488154 of comp.os.linux.misc
  2. Path: newsmaster.cc.columbia.edu!not-for-mail
  3. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.os.linux.misc,comp.protocols.kermit.misc
  5. Subject: Re: using rm to delete thru the tree
  6. Date: 19 Feb 2001 09:32:36 -0500
  7. Organization: Columbia University
  8. Lines: 64
  9. Message-ID: <96raq4$pke@watsun.cc.columbia.edu>
  10. References: <Pine.LNX.4.21.0102181824001.12961-100000@matrixuc.homeip.net> <z3_j6.124259$g6.60182676@news1.elmhst1.il.home.com> <96psu8$2dj$1@vizcacha.cox.rr.com>
  11. NNTP-Posting-Host: watsun.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 982593158 823 128.59.39.2 (19 Feb 2001 14:32:38 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 19 Feb 2001 14:32:38 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.os.linux.misc:488154 comp.protocols.kermit.misc:12171
  16.  
  17. In article <96psu8$2dj$1@vizcacha.cox.rr.com>,
  18. Adrian Mariano <adrian@cox.rr.com> wrote:
  19. : >"Sudhakar R." <ramasas@email.uc.edu> wrote in message
  20. : >> could someone please tell me how to go about deleting all files that match
  21. : >> the pattern *.*~ in every directory including sub-directories, sub-sub
  22. : >> directories and so on in one single sweep.
  23. : >
  24. : "Benjamin Good" <bmg@metallica.com> writes:
  25. : > rm -r is recursive delete.  Be careful using it.  See man rm.
  26. : It's true that 'rm -r' is recursive delete but it will not do what was
  27. : asked.  It will recursively delete entire directories (and all their
  28. : subdirectories).  There is no way to get it to delete only certain
  29. : files from the subdirectories.  
  30. A way to do this would be with the increasingly-all-purpose utility,
  31. C-Kermit:
  32.  
  33.   http://www.columbia.edu/kermit/ck71.html
  34.  
  35. If you want to delete all *.*~ files in the directory tree, the command is:
  36.  
  37.   delete /recursive *.*~
  38.  
  39. Some people might find this a bit more intuitive than
  40.  
  41.   find . -name \*.\*~ -exec rm -f {} \;
  42.  
  43. The C-Kermit 7.1 DELETE command has lots of flexibility as you can see
  44. from its list of options:
  45.  
  46. C-Kermit>delete ? File specification;
  47.  or switch, one of the following:
  48.  /after:         /except:        /nodotfiles     /recursive      /type:
  49.  /ask            /heading        /noheading      /simulate
  50.  /before:        /larger-than:   /nolist         /smaller-than:
  51.  /directories    /list           /not-after:     /summary
  52.  /dotfiles       /noask          /not-before:    /tree
  53. C-Kermit>
  54.  
  55. So if you wanted to delete recursively files whose names matched a certain
  56. pattern that were older than a certain date and were bigger than X but
  57. smaller than Y, except for a certain list of files, it's all there.
  58. "delete /tree" is like "rm -Rf" or "deltree".  "/simulate" lets you see
  59. what would happen without actually doing it.
  60.  
  61. By the way, when you say *.*~, if you really mean EMACS-style backup files,
  62. like foo.c.~3~, Kermit has a built-in command for that too: PURGE:
  63.  
  64. C-Kermit>purge ? Filename or switch, one of the following:
  65.  /after:         /except:        /list           /nolist       /page
  66.  /ask            /heading        /noask          /nopage       /recursive
  67.  /before:        /keep:          /nodotfiles     /not-after:   /simulate
  68.  /dotfiles       /larger-than:   /noheading      /not-before:  /smaller-than:
  69. C-Kermit>
  70.  
  71. As you can see, this one can also be applied recursively, plus you can
  72. tell it to keep a certain number of backup generations if you want.  In your
  73. case the command would be simply:
  74.  
  75.   purge /recursive *.*
  76.  
  77. - Frank
  78.